﻿using System.IO;
using log4net.Config;

namespace Hydra.Core
{
    /// <summary>
    /// class Hospital plays the role of Factory which creates 
    ///     various components and expose them via interfaces
    /// </summary>
    public static class Hospital
    {
        /// <summary>
        /// Create a doctor as application server
        /// </summary>
        public static IDoctor FindDoctor()
        {
            return new Surgeon();
        }

        /// <summary>
        /// Create a parasite as application client
        /// </summary>
        public static int CreateParasite(string args)
        {
            // initialize log4net but doesn't work!
            XmlConfigurator.ConfigureAndWatch(new FileInfo(@"d:\sd\nport\miles\Hydra\hydra.v0\Debug\parasite.xml"));

            Parasite.Instance.Connect();
            return 0;
        }

        public static IParasiteLogger GetLogger()
        {
            return Parasite.Instance;
        }
    }

    public interface  IParasiteLogger
    {
        void Info(string format, params object[] objs);
    }
}